//
//  YXHomeTitleButton.swift
//  微博YX
//
//  Created by apple on 15/11/26.
//  Copyright © 2015年 lyx. All rights reserved.
//

import UIKit

class YXHomeTitleButton: UIButton {

    init(title: String){
        super.init(frame: CGRectZero)
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(UIColor.grayColor(), forState: UIControlState.Normal)
        self.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        self.sizeToFit()
    }
    
    //    系统调用
    override func layoutSubviews() {
        //        一定要调用父类的
        super.layoutSubviews()
        titleLabel?.frame.origin.x = 0
        imageView?.frame.origin.x = titleLabel!.frame.width + 5
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
